#ifndef UNICODE
#define UNICODE
#endif

#include <MVCWin32.h>
#include "ApplicationDelegate.h"
#include "MyView.h"

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	//Create Objects
	MVCWin32::Application app;
	MVCWin32::Window win;
	MVCWin32::Menu menu;
	MVCWin32::Menu menuFile;
	MVCWin32::MenuItem menuItemFileQuit(L"Quit");
	ApplicationDelegate appDel;
	MyView view;

	//Set Properties
	win.SetTitle(L"Title");
	win.SetRect(100,100,800,600);
	win.SetMenu(&menu);
	win.SetView(&view);
	menu.AddSubMenu(&menuFile,L"File");
	menuFile.AddMenuItem(&menuItemFileQuit);

	//Set Object Pointers
	app.delegatePtr = &appDel;
	appDel.app = &app;

	//Set Events Handlers
	menuItemFileQuit.target = (MVCWin32::IEventHandler*)&appDel;
	menuItemFileQuit.eventPtr = (MVCWin32::EventPointer)&ApplicationDelegate::MenuFileQuit;

	//Initialize Objects
	app.Init();
	win.Init();
	menu.Init();
	menuFile.Init();
	menuItemFileQuit.Init();
	view.Init();
	appDel.Init();

	return app.Run();
}
